home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1997 April / macformat-049.iso / mac / Shareware Plus / Developers / dropg++ / usr / src / examples / showargs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-17  |  454 b   |  21 lines  |  [TEXT/R*ch]

  1. #include <fcntl.h>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. #include <sys/stat.h>
  5.  
  6. main(int argc, char **argv)
  7.     {
  8.     int i,inf,outf;
  9.     char *buf,name[99];
  10.         struct stat statbuf;
  11.     for (i = 0; i < argc; i++)
  12.         {
  13.         printf("Arg %d = \"%s\"\n", i, argv[i]);
  14.         }
  15.         fflush(stdout);
  16.         strcpy(name, argv[argc-1]);
  17.         if (stat(name, &statbuf)) perror(name),exit(-2);
  18.         printf("File size = %d bytes\n", statbuf.st_size);
  19.         exit(0);
  20.     }
  21.